import Mock from 'mockjs';
import qs from 'qs';
Mock.mock(/\/web\/orders\?/,"get",function(options){
  var str = options.url.slice(options.url.indexOf("?")+1);
  var item = qs.parse(str);
  console.log(item)
    return Mock.mock({
        "pageIndex": 1,
        "pageSize": 10,
        "total":10,
        "data|10": [
          {
            "id+1": 200,
            "orderNum|72082005306398345-72089999999999999":1
            ,
            "createAt": '@datetime',
            "customerId|180000-200000": 1,
            "totalAmount|250-1000":1,
            "storeName|1": ["一号仓库","二号仓库","三号仓库","四号仓库","五号仓库","六号仓库"],
            "storeNama|1": ["一号仓位","二号仓位","三号仓位","四号仓位","五号仓位","六号仓位"],
            "threeName|1":["螺丝钉","螺丝刀","天平","铁盘子","钢铁","塑料箱"],
            "peopName|1":["张三","张思","李林","王彩"],
            "time":"2022-2-26",
            "zhaungtai|1":function(){
              if(item.name&&item.name!="all"){return item.name}
              else{
                var list = ["满仓","空仓"]
                return list[Math.floor(Math.random()*list.length)]
              }
            },
            "caozuo|1":["入库","出库"]
          }
        ]
      }
 )
})

Mock.mock("/web/orders:statistics","get",function(){
  return Mock.mock({
    "todayOrder|100-300": 1,
    "unPaid|100-300": 1,
    "undelivered|100-300":1,
    "notReceived|100-300":1,
    "wan|1000-300":1,
    "unrefunded|100-200":1,
    "refunded|100-200":1
  })
})